package scyMachine

import (
	"github.com/gin-gonic/gin"
	"likeadmin/clog"
	"likeadmin/dbc"
	"likeadmin/model"
	"likeadmin/sqlop"
	"likeadmin/webu"
	"time"
)

func CreateScyMachine(c *gin.Context) {
	scyMachine := &model.ScyMachine{}
	c.ShouldBind(scyMachine)
	scyMachine.CreateTime = time.Now().Unix()
	clog.Info("scyMachine,CreateScyMachine,scyMachine=", scyMachine)
	err := dbc.DB.Create(scyMachine).Error
	webu.GinResult("CreateScyMachine Error:", c, err)
}

func UpdateScyMachine(c *gin.Context) {
	/*	scyMachine := &model.ScyMachine{}
		c.ShouldBind(scyMachine)
		clog.Info("scyMachine,UpdateScyMachine,scyMachine=", scyMachine)
		err := sqlop.ExecFourP("update scy_machine set scy_machine_name=?,scy_machine_introduction=?,update_time=? where id=?", scyMachine.ScyMachineName, scyMachine.ScyMachineIntroduction, time.Now().Unix(), scyMachine.Id)
		webu.GinResult("UpdateScyMachine Error:", c, err)*/

}

func DeleteScyMachine(c *gin.Context) {
	scyMachine := &model.ScyMachine{}
	c.ShouldBind(scyMachine)
	clog.Info("scyMachine,DeleteScyMachine,scyMachine=", scyMachine)
	err := sqlop.ExecTwoP("update scy_machine set is_deleted=1,delete_time=? where id=?", time.Now().Unix(), scyMachine.Id)
	webu.GinResult("DeleteScyMachine Error:", c, err)
}
